package com.tianhui.consignortwofei.mvp.model;

import android.content.Context;

import com.fgs.common.CommonModel;
import com.fgs.common.api.CommonConfig;
import com.fgs.common.progress.ObserverResponseListener;
import com.tianhui.consignortwofei.api.MessageApiService;

import java.util.Map;

import io.reactivex.ObservableTransformer;

/**
 * @author fgs
 * @date 2020/9/24
 * @description
 **/
public class MessageModel<T> extends CommonModel<T> {
    /**
     * 消息列表
     *
     * @param context
     * @param map
     * @param isDialog
     * @param transformer
     * @param observerListener
     */
    public void messageListModel(Context context, Map<String, String> map, boolean isDialog,
                                 ObservableTransformer<T, T> transformer, ObserverResponseListener observerListener) {

        subscribe(context, CommonConfig.getInstance().create(MessageApiService.class).messageList(map), observerListener, transformer, isDialog, true);
    }

    /**
     * 消息阅读
     *
     * @param context
     * @param map
     * @param isDialog
     * @param transformer
     * @param observerListener
     */
    public void readMessageModel(Context context, Map<String, String> map, boolean isDialog,
                                 ObservableTransformer<T, T> transformer, ObserverResponseListener observerListener) {

        subscribe(context, CommonConfig.getInstance().create(MessageApiService.class).readMessage(map), observerListener, transformer, isDialog, true);
    }

    /**
     * 消息数量
     *
     * @param context
     * @param isDialog
     * @param transformer
     * @param observerListener
     */
    public void messageQualityModel(Context context, boolean isDialog,
                                    ObservableTransformer<T, T> transformer, ObserverResponseListener observerListener) {

        subscribe(context, CommonConfig.getInstance().create(MessageApiService.class).messageQuality(), observerListener, transformer, isDialog, true);
    }

    /**
     * 批量移除消息
     *
     * @param context
     * @param map
     * @param isDialog
     * @param transformer
     * @param observerListener
     */
    public void removeMessageModel(Context context, Map<String, String> map, boolean isDialog,
                                 ObservableTransformer<T, T> transformer, ObserverResponseListener observerListener) {

        subscribe(context, CommonConfig.getInstance().create(MessageApiService.class).removeMessage(map), observerListener, transformer, isDialog, true);
    }


    /**
     * 消息数量
     *
     * @param context
     * @param isDialog
     * @param transformer
     * @param observerListener
     */
    public void getShengShi(Context context, boolean isDialog,
                                    ObservableTransformer<T, T> transformer, ObserverResponseListener observerListener) {

        subscribe(context, CommonConfig.getInstance().create(MessageApiService.class).getShengShi(), observerListener, transformer, isDialog, true);
    }



}
